package c.d.a.a.h;

import android.view.MotionEvent;
import android.view.animation.AnimationUtils;
import c.d.a.a.j.d;
import com.github.mikephil.charting.charts.PieRadarChartBase;
import java.util.ArrayList;

/* compiled from: PieRadarChartTouchListener */
public class f extends b<PieRadarChartBase<?>> {
    public d f = d.b(0.0f, 0.0f);
    public float g = 0.0f;
    public ArrayList<a> h = new ArrayList();
    public long i = 0;
    public float j = 0.0f;

    /* compiled from: PieRadarChartTouchListener */
    public class a {
        public long a;
        public float b;

        public a(f fVar, long j, float f) {
            this.a = j;
            this.b = f;
        }
    }

    public f(PieRadarChartBase<?> pieRadarChartBase) {
        super(pieRadarChartBase);
    }

    public final void b(float f, float f2) {
        long currentAnimationTimeMillis = AnimationUtils.currentAnimationTimeMillis();
        this.h.add(new a(this, currentAnimationTimeMillis, ((PieRadarChartBase) this.e).o(f, f2)));
        for (int size = this.h.size(); size - 2 > 0 && currentAnimationTimeMillis - ((a) this.h.get(0)).a > 1000; size--) {
            this.h.remove(0);
        }
    }

    public void onLongPress(MotionEvent motionEvent) {
        this.a = c.d.a.a.h.b.a.LONG_PRESS;
        c onChartGestureListener = ((PieRadarChartBase) this.e).getOnChartGestureListener();
        if (onChartGestureListener != null) {
            onChartGestureListener.h(motionEvent);
        }
    }

    public boolean onSingleTapConfirmed(MotionEvent motionEvent) {
        return true;
    }

    public boolean onSingleTapUp(MotionEvent motionEvent) {
        this.a = c.d.a.a.h.b.a.SINGLE_TAP;
        c onChartGestureListener = ((PieRadarChartBase) this.e).getOnChartGestureListener();
        if (onChartGestureListener != null) {
            onChartGestureListener.f(motionEvent);
        }
        PieRadarChartBase pieRadarChartBase = (PieRadarChartBase) this.e;
        if (!pieRadarChartBase.c) {
            return false;
        }
        a(pieRadarChartBase.f(motionEvent.getX(), motionEvent.getY()));
        return true;
    }

    /* JADX WARNING: Removed duplicated region for block: B:23:0x008a  */
    @android.annotation.SuppressLint({"ClickableViewAccessibility"})
    public boolean onTouch(android.view.View r19, android.view.MotionEvent r20) {
        /*
        r18 = this;
        r0 = r18;
        r1 = r20;
        r2 = r0.d;
        r2 = r2.onTouchEvent(r1);
        r3 = 1;
        if (r2 == 0) goto L_0x000e;
    L_0x000d:
        return r3;
    L_0x000e:
        r2 = r0.e;
        r2 = (com.github.mikephil.charting.charts.PieRadarChartBase) r2;
        r2 = r2.I;
        if (r2 == 0) goto L_0x01a4;
    L_0x0016:
        r2 = r20.getX();
        r4 = r20.getY();
        r5 = r20.getAction();
        r6 = 0;
        if (r5 == 0) goto L_0x016c;
    L_0x0025:
        if (r5 == r3) goto L_0x0091;
    L_0x0027:
        r6 = 2;
        if (r5 == r6) goto L_0x002c;
    L_0x002a:
        goto L_0x01a4;
    L_0x002c:
        r5 = r0.e;
        r5 = (com.github.mikephil.charting.charts.PieRadarChartBase) r5;
        r5 = r5.d;
        if (r5 == 0) goto L_0x0037;
    L_0x0034:
        r0.b(r2, r4);
    L_0x0037:
        r5 = r0.b;
        r6 = 6;
        if (r5 != 0) goto L_0x0069;
    L_0x003c:
        r5 = r0.f;
        r7 = r5.b;
        r5 = r5.c;
        r7 = r2 - r7;
        r5 = r4 - r5;
        r7 = r7 * r7;
        r5 = r5 * r5;
        r5 = r5 + r7;
        r7 = (double) r5;
        r7 = java.lang.Math.sqrt(r7);
        r5 = (float) r7;
        r7 = 1090519040; // 0x41000000 float:8.0 double:5.38787994E-315;
        r7 = c.d.a.a.j.g.d(r7);
        r5 = (r5 > r7 ? 1 : (r5 == r7 ? 0 : -1));
        if (r5 <= 0) goto L_0x0069;
    L_0x005b:
        r2 = c.d.a.a.h.b.a.ROTATE;
        r0.a = r2;
        r0.b = r6;
        r2 = r0.e;
        r2 = (com.github.mikephil.charting.charts.PieRadarChartBase) r2;
        r2.c();
        goto L_0x0082;
    L_0x0069:
        r5 = r0.b;
        if (r5 != r6) goto L_0x0082;
    L_0x006d:
        r5 = r0.e;
        r5 = (com.github.mikephil.charting.charts.PieRadarChartBase) r5;
        r2 = r5.o(r2, r4);
        r4 = r0.g;
        r2 = r2 - r4;
        r5.setRotationAngle(r2);
        r2 = r0.e;
        r2 = (com.github.mikephil.charting.charts.PieRadarChartBase) r2;
        r2.invalidate();
    L_0x0082:
        r2 = r0.e;
        r2 = r2.getOnChartGestureListener();
        if (r2 == 0) goto L_0x01a4;
    L_0x008a:
        r4 = r0.a;
        r2.g(r1, r4);
        goto L_0x01a4;
    L_0x0091:
        r5 = r0.e;
        r5 = (com.github.mikephil.charting.charts.PieRadarChartBase) r5;
        r5 = r5.d;
        r7 = 0;
        if (r5 == 0) goto L_0x014f;
    L_0x009a:
        r0.j = r6;
        r0.b(r2, r4);
        r2 = r0.h;
        r2 = r2.isEmpty();
        if (r2 == 0) goto L_0x00aa;
    L_0x00a7:
        r2 = 0;
        goto L_0x013c;
    L_0x00aa:
        r2 = r0.h;
        r2 = r2.get(r7);
        r2 = (c.d.a.a.h.f.a) r2;
        r4 = r0.h;
        r5 = r4.size();
        r5 = r5 - r3;
        r4 = r4.get(r5);
        r4 = (c.d.a.a.h.f.a) r4;
        r5 = r0.h;
        r5 = r5.size();
        r5 = r5 - r3;
        r8 = r2;
    L_0x00c7:
        if (r5 < 0) goto L_0x00dd;
    L_0x00c9:
        r8 = r0.h;
        r8 = r8.get(r5);
        r8 = (c.d.a.a.h.f.a) r8;
        r9 = r8.b;
        r10 = r4.b;
        r9 = (r9 > r10 ? 1 : (r9 == r10 ? 0 : -1));
        if (r9 == 0) goto L_0x00da;
    L_0x00d9:
        goto L_0x00dd;
    L_0x00da:
        r5 = r5 + -1;
        goto L_0x00c7;
    L_0x00dd:
        r9 = r4.a;
        r11 = r2.a;
        r9 = r9 - r11;
        r5 = (float) r9;
        r9 = 1148846080; // 0x447a0000 float:1000.0 double:5.676053805E-315;
        r5 = r5 / r9;
        r9 = (r5 > r6 ? 1 : (r5 == r6 ? 0 : -1));
        if (r9 != 0) goto L_0x00ed;
    L_0x00ea:
        r5 = 1036831949; // 0x3dcccccd float:0.1 double:5.122630465E-315;
    L_0x00ed:
        r9 = r4.b;
        r8 = r8.b;
        r10 = (r9 > r8 ? 1 : (r9 == r8 ? 0 : -1));
        if (r10 < 0) goto L_0x00f7;
    L_0x00f5:
        r10 = 1;
        goto L_0x00f8;
    L_0x00f7:
        r10 = 0;
    L_0x00f8:
        r9 = r9 - r8;
        r8 = java.lang.Math.abs(r9);
        r8 = (double) r8;
        r11 = 4643457506423603200; // 0x4070e00000000000 float:0.0 double:270.0;
        r13 = (r8 > r11 ? 1 : (r8 == r11 ? 0 : -1));
        if (r13 <= 0) goto L_0x0109;
    L_0x0107:
        r10 = r10 ^ 1;
    L_0x0109:
        r8 = r4.b;
        r9 = r2.b;
        r11 = r8 - r9;
        r11 = (double) r11;
        r13 = 4645040803167600640; // 0x4076800000000000 float:0.0 double:360.0;
        r15 = 4640537203540230144; // 0x4066800000000000 float:0.0 double:180.0;
        r17 = (r11 > r15 ? 1 : (r11 == r15 ? 0 : -1));
        if (r17 <= 0) goto L_0x0124;
    L_0x011e:
        r8 = (double) r9;
        r8 = r8 + r13;
        r8 = (float) r8;
        r2.b = r8;
        goto L_0x012f;
    L_0x0124:
        r9 = r9 - r8;
        r11 = (double) r9;
        r9 = (r11 > r15 ? 1 : (r11 == r15 ? 0 : -1));
        if (r9 <= 0) goto L_0x012f;
    L_0x012a:
        r8 = (double) r8;
        r8 = r8 + r13;
        r8 = (float) r8;
        r4.b = r8;
    L_0x012f:
        r4 = r4.b;
        r2 = r2.b;
        r4 = r4 - r2;
        r4 = r4 / r5;
        r2 = java.lang.Math.abs(r4);
        if (r10 != 0) goto L_0x013c;
    L_0x013b:
        r2 = -r2;
    L_0x013c:
        r0.j = r2;
        r2 = (r2 > r6 ? 1 : (r2 == r6 ? 0 : -1));
        if (r2 == 0) goto L_0x014f;
    L_0x0142:
        r4 = android.view.animation.AnimationUtils.currentAnimationTimeMillis();
        r0.i = r4;
        r2 = r0.e;
        r4 = c.d.a.a.j.g.a;
        r2.postInvalidateOnAnimation();
    L_0x014f:
        r2 = r0.e;
        r2 = (com.github.mikephil.charting.charts.PieRadarChartBase) r2;
        r2 = r2.getParent();
        if (r2 == 0) goto L_0x015c;
    L_0x0159:
        r2.requestDisallowInterceptTouchEvent(r7);
    L_0x015c:
        r0.b = r7;
        r2 = r0.e;
        r2 = r2.getOnChartGestureListener();
        if (r2 == 0) goto L_0x01a4;
    L_0x0166:
        r4 = r0.a;
        r2.g(r1, r4);
        goto L_0x01a4;
    L_0x016c:
        r5 = r0.e;
        r5 = r5.getOnChartGestureListener();
        if (r5 == 0) goto L_0x0179;
    L_0x0174:
        r7 = r0.a;
        r5.a(r1, r7);
    L_0x0179:
        r0.j = r6;
        r1 = r0.h;
        r1.clear();
        r1 = r0.e;
        r1 = (com.github.mikephil.charting.charts.PieRadarChartBase) r1;
        r1 = r1.d;
        if (r1 == 0) goto L_0x018b;
    L_0x0188:
        r0.b(r2, r4);
    L_0x018b:
        r1 = r0.e;
        r1 = (com.github.mikephil.charting.charts.PieRadarChartBase) r1;
        r1 = r1.o(r2, r4);
        r5 = r0.e;
        r5 = (com.github.mikephil.charting.charts.PieRadarChartBase) r5;
        r5 = r5.getRawRotationAngle();
        r1 = r1 - r5;
        r0.g = r1;
        r1 = r0.f;
        r1.b = r2;
        r1.c = r4;
    L_0x01a4:
        return r3;
        */
        throw new UnsupportedOperationException("Method not decompiled: c.d.a.a.h.f.onTouch(android.view.View, android.view.MotionEvent):boolean");
    }
}
